package org.miframework.arqsw.tags;

import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

public class Tabla extends TagSupport {
	private int filas,columnas,borde=0;
	
    public void setFilas(int filas){
        this.filas = filas;
    }
    public void setColumnas(int columnas){
        this.columnas = columnas;
    }
    public void setBorde(int borde){
    	this.borde=borde;
    }
	
	@Override
	public int doStartTag() throws JspException {
		JspWriter out = pageContext.getOut();
		try {
			
			out.print("<table border="+(char)24+borde+(char)24+">");
			for(int i=0; i<filas; i++){
				out.print("<tr>");
				for(int j=0; j<columnas; j++){
					out.print("<td>&nbsp;&nbsp;&nbsp;&nbsp;"+"</td>");
				}
				out.print("</tr>");
			}
			out.print("</table>");			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return SKIP_BODY;
	}
	
}